import {defineConfig} from "vite";
import uni from "@dcloudio/vite-plugin-uni";
//import {visualizer} from "rollup-plugin-visualizer";
import commonjs from '@rollup/plugin-commonjs';
//import path from "path";
// https://vitejs.dev/config/
export default defineConfig({
/* 	rollupOutputOptions: {
	    exports: 'default',
	}, */
	plugins: [
		commonjs(
			{include: ['js_sdk/**/*.js', 'node_modules/**/*.js','page/**/*.vue']}
		),
		uni(),
		//visualizer(),
		// 配置requireTransform插件，用于处理require语法，例如：require('@/pages/login/login.vue')
		//requireTransform({fileRegex: /.js$|.vue$/})
	],
	build: {
		sourcemap: true,
		minify: "terser", // 必须开启：使用terserOptions才有效果
		terserOptions: {
			compress: {
				//生产环境时移除console
				//drop_console: true,
				//drop_debugger: true,
			}
		}
	},
	resolve: {
		//配置根路径别名： import('@/pages/login/login.vue')
		alias: {
			//"@": path.resolve(__dirname, ""), 
			// 注意一定不要随意命名，a b c这样的，项目的目录也不能为关键字保留字！！
			//"comp": resolve(__dirname, "src/components"),
			// 配置图片要这样引用
			//"/img": "./src/assets",
		}
	}
});